39#ifdef PREINIT_SUPPORTED
43#ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49#include "drv_digital_out.h"
50#include "drv_digital_in.h"
73#define NINAB222_CMD_AT "AT"
79#define NINAB222_CMD_CGMI "CGMI"
80#define NINAB222_CMD_CGMM "CGMM"
81#define NINAB222_CMD_CGMR "CGMR"
82#define NINAB222_CMD_CGSN "CGSN"
83#define NINAB222_CMD_GMI "GMI"
84#define NINAB222_CMD_GMM "GMM"
85#define NINAB222_CMD_GMR "GMR"
86#define NINAB222_CMD_GSN "GSN"
87#define NINAB222_CMD_ATI "ATI"
88#define NINAB222_CMD_CSGT "CSGT"
94#define NINAB222_CMD_ATW "W"
95#define NINAB222_CMD_ATZ "ATZ"
96#define NINAB222_CMD_ATE "ATE"
97#define NINAB222_CMD_UFACTORY "UFACTORY"
98#define NINAB222_CMD_ATD "D"
99#define NINAB222_CMD_ATS "S"
100#define NINAB222_CMD_CPWROFF "CPWROFF"
101#define NINAB222_CMD_UFWUPD "UFWUPD"
102#define NINAB222_CMD_UMLA "UMLA"
103#define NINAB222_CMD_UMLPO "UMLPO"
104#define NINAB222_CMD_UMRS "UMRS"
105#define NINAB222_CMD_UMRSCFG "UMRSCFG"
106#define NINAB222_CMD_UMRSIG "UMRSIG"
107#define NINAB222_CMD_UMSM "UMSM"
108#define NINAB222_CMD_UMSTAT "UMSTAT"
109#define NINAB222_CMD_UPWRMNG "UPWRMNG"
110#define NINAB222_CMD_UPWRREG "UPWRREG"
111#define NINAB222_CMD_USTOP "USTOP"
117#define NINAB222_CMD_ATO "ATO"
118#define NINAB222_CMD_UDATR "UDATR"
119#define NINAB222_CMD_UDATW "UDATW"
120#define NINAB222_CMD_UDBIND "UDBIND"
121#define NINAB222_CMD_UDBINDC "UDBINDC"
122#define NINAB222_CMD_UDCFG "UDCFG"
123#define NINAB222_CMD_UDCP "UDCP"
124#define NINAB222_CMD_UDCPC "UDCPC"
125#define NINAB222_CMD_UDDRP "UDDRP"
126#define NINAB222_CMD_UDLP "UDLP"
127#define NINAB222_CMD_UDSC "UDSC"
128#define NINAB222_CMD_UDSF "UDSF"
129#define NINAB222_CMD_UDUV "UDUV"
130#define NINAB222_CMD_UDWS "UDWS"
131#define NINAB222_CMD_UUDATA "UUDATA"
132#define NINAB222_CMD_UUDPC "UUDPC"
133#define NINAB222_CMD_UUDPD "UUDPD"
139#define NINAB222_CMD_UBTDM "UBTDM"
140#define NINAB222_CMD_UBTCM "UBTCM"
141#define NINAB222_CMD_UBTPM "UBTPM"
142#define NINAB222_CMD_UBTSM "UBTSM"
143#define NINAB222_CMD_UBTST "UBTST"
144#define NINAB222_CMD_UBTUC "UBTUC"
145#define NINAB222_CMD_UBTUPE "UBTUPE"
146#define NINAB222_CMD_UBTOTK "UBTOTK"
147#define NINAB222_CMD_UBTND "UBTND"
148#define NINAB222_CMD_UBTI "UBTI"
149#define NINAB222_CMD_UBTD "UBTD"
150#define NINAB222_CMD_UBTBD "UBTBD"
151#define NINAB222_CMD_UBTB "UBTB"
152#define NINAB222_CMD_UBTUB "UBTUB"
153#define NINAB222_CMD_UBTLN "UBTLN"
154#define NINAB222_CMD_UBTLC "UBTLC"
155#define NINAB222_CMD_UBTMSR "UBTMSR"
156#define NINAB222_CMD_UBTMSP "UBTMSP"
157#define NINAB222_CMD_UBTRSS "UBTRSS"
158#define NINAB222_CMD_UBTLQ "UBTLQ"
159#define NINAB222_CMD_UBTLE "UBTLE"
160#define NINAB222_CMD_UBTAD "UBTAD"
161#define NINAB222_CMD_UBTSS "UBTSS"
162#define NINAB222_CMD_UBTWS "UBTWS"
163#define NINAB222_CMD_UBTCFG "UBTCFG"
164#define NINAB222_CMD_UBTLECFG "UBTLECFG"
165#define NINAB222_CMD_UBTDIR "UBTDIR"
166#define NINAB222_CMD_UBTACLC "UBTACLC"
167#define NINAB222_CMD_UBTACLD "UBTACLD"
168#define NINAB222_CMD_UBTLK "UBTLK"
174#define NINAB222_PREFIX_SYMBOL_END "\r\n"
175#define NINAB222_PREFIX_SYMBOL_QUERY "?"
176#define NINAB222_PREFIX_SYMBOL_SET_VAL "="
177#define NINAB222_PREFIX_SYMBOL_PLUS "+"
178#define NINAB222_PREFIX_SYMBOL_AND "&"
179#define NINAB222_PREFIX_SYMBOL_SEPARATOR ","
180#define NINAB222_PREFIX_SYMBOL_SPACE " "
181#define NINAB222_PREFIX_SYMBOL_PERCENT "%"
182#define NINAB222_PREFIX_SYMBOL_NULL ""
183#define NINAB222_PREFIX_SYMBOL_QUOTE "\""
184#define NINAB222_PREFIX_SYMBOL_SPS "sps://"
185#define NINAB222_PREFIX_SYMBOL_ZERO "0"
186#define NINAB222_PREFIX_SYMBOL_ONE "1"
187#define NINAB222_PREFIX_SYMBOL_TWO "2"
193#define NINAB222_RSP_OK "OK"
194#define NINAB222_RSP_ERROR "ERROR"
200#define NINAB222_ECHO_OFF 0
201#define NINAB222_ECHO_ON 1
207#define NINAB222_MODE_COMMAND 0
208#define NINAB222_MODE_DATA 1
209#define NINAB222_MODE_EXT_DATA 2
210#define NINAB222_MODE_PPP 3
216#define NINAB222_GAP_MODE_NON_PAIRING 0
217#define NINAB222_GAP_MODE_PAIRING 1
223#define NINAB222_LR_ROLE_DISABLE 0
224#define NINAB222_LR_ROLE_CENTRAL 1
225#define NINAB222_LR_ROLE_PERIPHERAL 2
226#define NINAB222_LR_ROLE_SIMULTANEOUS 3
232#define NINAB222_GAP_MODE_NON_CONN 1
233#define NINAB222_GAP_MODE_CONN 2
239#define NINAB222_GAP_MODE_NON_DIS 1
240#define NINAB222_GAP_MODE_LIM_DIS 2
241#define NINAB222_GAP_MODE_GEN_DISC 3
247#define NINAB222_ASCII_TABLE_START_NUM 48
253#define NINAB222_PIN_STATE_LOW 0
254#define NINAB222_PIN_STATE_HIGH 1
261#define NINAB222_TX_DRV_BUFFER_SIZE 100
262#define NINAB222_RX_DRV_BUFFER_SIZE 300
280#define NINAB222_MAP_MIKROBUS( cfg, mikrobus ) \
281 cfg.tx_pin = MIKROBUS( mikrobus, MIKROBUS_TX ); \
282 cfg.rx_pin = MIKROBUS( mikrobus, MIKROBUS_RX ); \
283 cfg.sry = MIKROBUS( mikrobus, MIKROBUS_AN ); \
284 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
285 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
286 cfg.io5 = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
287 cfg.rts = MIKROBUS( mikrobus, MIKROBUS_INT );
#define NINAB222_TX_DRV_BUFFER_SIZE
NINA-B222 driver buffer size.
Definition ninab222.h:261
#define NINAB222_RX_DRV_BUFFER_SIZE
Definition ninab222.h:262
void ninab222_set_io5_pin(ninab222_t *ctx, uint8_t state)
NINA-B222 set IO5 pin state function.
err_t ninab222_get_peers_list(ninab222_t *ctx)
NINA-B222 get low energy role function.
err_t ninab222_rst_def_cfg(ninab222_t *ctx)
NINA-B222 set to factory defined configuration function.
err_t ninab222_periph_pairing_cfg(ninab222_t *ctx)
NINA-B222 default remote peer function.
err_t ninab222_get_discoverability(ninab222_t *ctx)
NINA-B222 sets discoverability mode function.
err_t ninab222_generic_read(ninab222_t *ctx, uint8_t *data_out, uint16_t len)
NINA-B222 data reading function.
err_t ninab222_set_bt_intf(ninab222_t *ctx)
NINA-B222 store current configuration function.
err_t ninab222_init(ninab222_t *ctx, ninab222_cfg_t *cfg)
NINA-B222 initialization function.
err_t ninab222_set_discoverability(ninab222_t *ctx, uint8_t d_mode)
NINA-B222 sets discoverability mode function.
err_t ninab222_set_start_mode(ninab222_t *ctx, uint8_t start_mode)
NINA-B222 sets start mode function.
err_t ninab222_write_cmd(ninab222_t *ctx, uint8_t *command)
NINA-B222 command writing function.
err_t ninab222_get_le_role(ninab222_t *ctx)
NINA-B222 get low energy role function.
void ninab222_set_sry_pin(ninab222_t *ctx, uint8_t state)
NINA-B222 set SRY pin state function.
err_t ninab222_remote_peer(ninab222_t *ctx, uint8_t *domain)
NINA-B222 default remote peer function.
err_t ninab222_set_pairing_mode(ninab222_t *ctx, uint8_t p_mode)
NINA-B222 sets pairing mode function.
void ninab222_hw_reset(ninab222_t *ctx)
NINA-B222 HW reset function.
err_t ninab222_get_start_mode(ninab222_t *ctx)
NINA-B222 get start mode function.
err_t ninab222_get_device_name(ninab222_t *ctx)
NINA-B222 get device name function.
err_t ninab222_set_enter_mode(ninab222_t *ctx, uint8_t enter_mode)
NINA-B222 sets enter mode function.
err_t ninab222_reboot_dce(ninab222_t *ctx)
NINA-B222 reboot DCE function.
err_t ninab222_inquire_cmd(ninab222_t *ctx, uint8_t *command)
NINA-B222 inquire command function.
err_t ninab222_set_le_role(ninab222_t *ctx, uint8_t le_role)
NINA-B222 sets low energy role function.
err_t ninab222_set_echo(ninab222_t *ctx, uint8_t echo_en)
NINA-B222 set echo function.
err_t ninab222_write_sys_cmd(ninab222_t *ctx, uint8_t *command)
NINA-B222 system command writing function.
err_t ninab222_set_default_cfg(ninab222_t *ctx)
NINA-B222 sets the default configuration function.
err_t ninab222_set_connectability(ninab222_t *ctx, uint8_t c_mode)
NINA-B222 sets connectabilit mode function.
uint8_t ninab222_request_to_send(ninab222_t *ctx)
NINA-B222 get request to send pin state function.
err_t ninab222_set_device_name(ninab222_t *ctx, uint8_t *device_name)
NINA-B222 sets device name function.
void ninab222_clear_to_send(ninab222_t *ctx, uint8_t cts)
NINA-B222 set clear to send pin state function.
void ninab222_cfg_setup(ninab222_cfg_t *cfg)
NINA-B222 configuration object setup function.
err_t ninab222_generic_write(ninab222_t *ctx, uint8_t *data_in, uint16_t len)
NINA-B222 data writing function.
err_t ninab222_write_cmd_param(ninab222_t *ctx, uint8_t *command, uint8_t *param)
NINA-B222 command - parameter writing function.
err_t ninab222_get_connectability(ninab222_t *ctx)
NINA-B222 sets connectabilit mode function.
err_t ninab222_get_info(ninab222_t *ctx)
NINA-B222 get module-info function.
ninab222_return_value_t
NINA-B222 Click return value data.
Definition ninab222.h:347
@ NINAB222_OK
Definition ninab222.h:348
@ NINAB222_ERROR
Definition ninab222.h:349
NINA-B222 Click configuration object.
Definition ninab222.h:321
pin_name_t rts
Definition ninab222.h:331
uint32_t baud_rate
Definition ninab222.h:334
pin_name_t io5
Definition ninab222.h:330
bool uart_blocking
Definition ninab222.h:335
uart_data_bits_t data_bit
Definition ninab222.h:336
pin_name_t tx_pin
Definition ninab222.h:324
pin_name_t rx_pin
Definition ninab222.h:323
uart_stop_bits_t stop_bit
Definition ninab222.h:338
pin_name_t sry
Definition ninab222.h:327
uart_parity_t parity_bit
Definition ninab222.h:337
pin_name_t rst
Definition ninab222.h:328
pin_name_t cs
Definition ninab222.h:329
NINA-B222 Click context object.
Definition ninab222.h:297
digital_out_t cs
Definition ninab222.h:300
digital_out_t io5
Definition ninab222.h:301
uart_t uart
Definition ninab222.h:308
digital_out_t sry
Definition ninab222.h:302
digital_in_t rts
Definition ninab222.h:305
digital_out_t rst
Definition ninab222.h:299
uint8_t uart_tx_buffer[NINAB222_TX_DRV_BUFFER_SIZE]
Definition ninab222.h:312
uint8_t uart_rx_buffer[NINAB222_RX_DRV_BUFFER_SIZE]
Definition ninab222.h:311